<?php
//var_dump();
class Version extends BaseModel
{
	public $res;
	public $expire;
	public function getSource()
    {
        return "f_version";
    }


    /**
     * @func 获取系统最新的版本
     */
    public function find_by_newVersion($source){
        $condition = "platform='{$source}'";
        $user_list = $this::findFirst(
            array(
                $condition,
                "order" => 'id DESC',
            )
        );
        return $user_list;
    }




    /**
     * @func 获取系统最新的版本
     */
    public function find_by_newVersion_new($version,$platform){
        $condition = "platform='{$platform}' and version>'{$version}'";
        $user_list = $this::findFirst(
            array(
                $condition,
                "order" => 'id DESC',
                'columns'=>'id,version as versionCode,title as versionName,description as versionInfo,is_force as forceUpdate,url as downloadUrl'
            )
        );
        if($user_list){
            return $user_list->toarray();
        }else{
            return [];
        }
    }

}
